package com.lh.createData.service.Impl;

import com.lh.createData.dao.LogMapper;
import com.lh.createData.model.InPutParam.LogInParam;
import com.lh.createData.service.LogService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Calendar;
import java.util.Date;

/**
 * @author ：梁昊，后端工程师：梁昊
 * @create 2021-08-13 09:58
 * @function
 * @editLog
 */
@SuppressWarnings("SpringJavaInjectionPointsAutowiringInspection")
@Service
public class LogServiceImpl implements LogService {
    @Autowired
    LogMapper logMapper;

    /**
     * 增加日志
     *
     * @param logInParam com.lh.createData.model.InPutParam.LogInParam
     * @return 影响条数
     */
    @Override
    public int insertLog(LogInParam logInParam, int deleteLogYearCount) {
        return logMapper.insertLog(logInParam);
    }

    @Override
    public int insertLog(String userId, String userName, String content, int deleteLogYearCount) {
        LogInParam logInParam = new LogInParam();
        logInParam.setUserId(userId);
        logInParam.setUserName(userName);
        logInParam.setContent(content);
        final int insertLog = logMapper.insertLog(logInParam);
        return insertLog;
    }

    @Override
    public int insertSystemLog(String content) {
        return insertLog("autoTask", "自动任务", content, 0);
    }

    @Override
    public int insertSystemLog(String content, int deleteLogYearCount) {
        return insertLog("autoTask", "自动任务", content, deleteLogYearCount);
    }
}
